/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.ui.rich.learn.learn_view.dialog;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

import br.ufmg.dees.insane.ui.rich.learn.learn_view.LearnInterface;
import br.ufmg.dees.insane.ui.rich.learn.learn_view.ViewState;
import br.ufmg.dees.insane.ui.rich.learn.learn_view.command.LastZoomCommand;

/**
 * A class representing creation dialog on screen.
 *
 * @author Fonseca, Flavio & Pitangueira, Roque
 * @see gui.Interface
 * @since July 2004
 */
public final class AttributesSettingsDialog extends SimpleDialog {
	
	private static final long serialVersionUID = 1L;
	private LearnInterface parent;
    private JPanel attributesPane = new JPanel();
	
//*****************************************************************************
	
    /**
     * Constructor method, calling super with the especific title.
     *
     * @param parent The parent of the class.
     * @see gui.Interface
     */
    public AttributesSettingsDialog(LearnInterface parent, ViewState s) {
        this.parent = parent;
        
		//Sets up the attributes panel
		attributesPane.setLayout(new GridLayout(10,3,2,2));
        attributesPane.setBorder(BorderFactory.createCompoundBorder(
        BorderFactory.createTitledBorder("Attributes colors"),
        BorderFactory.createEmptyBorder(2,2,2,2)));
		attributesPane.setMaximumSize(new Dimension(500,300));
        
		
		setPane(attributesPane);
		
    }
	
//*****************************************************************************
    
    public int showDialog() {
        return super.showDialog(parent, "Attributes Colors Settings");
    }
	
//*****************************************************************************
	
    /**
     * This method is executed on OK button click.
     *
     */
    public void approvedPerform() {
        try {
            			
			parent.setModel(parent.getModel());
            this.setVisible(false);
			
			LastZoomCommand cmd = new LastZoomCommand(parent);
			cmd.execute();
			
        } catch (Exception err) {
            Toolkit.getDefaultToolkit().beep();
            this.setVisible(false);
        }
    }
    

}
